import axios from 'axios';

const api = axios.create({
  baseURL: '/api',
  timeout: 30000
});

// 文件上传接口
export const uploadFile = (formData, onUploadProgress) => {
  return api.post('/knowledge/upload', formData, {
    headers: {
      'Content-Type': 'multipart/form-data'
    },
    onUploadProgress
  });
};

// 聊天接口
export const chatCompletion = (payload) => {
  return api.post('/chat/completion', payload);
};

// 知识库状态接口
export const getKnowledgeStatus = () => {
  return api.get('/knowledge/status');
};

export default api; 